﻿namespace SEED.SEEDModels {
    using System;
    using SEEDControllers;
    using System.Collections.Generic;
    
    public class Waveform {
        #region fields of Waveform
        private byte[] waveData = null;
        #endregion

        #region properties of Waveform
        public string Enconding  { get; set; }
        public bool   SwapBytes  { get; set; }
        public int    NumSamples { get; set; }
        public string StationName { get; set; }
        public string ChannelName { get; set; }
        public string NetworkCode { get; set; }

        public int[] WaveData {
            get {
                return Steim1.Decode(waveData, NumSamples, false);
            }
        }


        #endregion

        public override string ToString() {
            return base.ToString();
        }


        #region constructors of Waveform
        public Waveform() { }
        public Waveform(byte[] record, int numSamples, string encoding) {
            waveData = new byte[record.Length];
            Array.Copy(record, 0, waveData, 0, waveData.Length);
            this.NumSamples = numSamples;
            this.SwapBytes = false;
            this.Enconding = encoding;
        }
        public Waveform(byte[] record, int dataOffset, int numSamples, string encoding) {
            waveData = new byte[record.Length - dataOffset];
            Array.Copy(record, dataOffset, waveData, 0, waveData.Length);
            this.NumSamples = numSamples;
            this.SwapBytes = false;
            this.Enconding = encoding;
        }
        public Waveform(byte[] record, int dataOffset, int numSamples, string encoding, bool swapBytes) {
            waveData = new byte[record.Length - dataOffset];
            Array.Copy(record, dataOffset, waveData, 0, waveData.Length);
            this.NumSamples = numSamples;
            this.SwapBytes  = swapBytes;
            this.Enconding  = encoding;
        }
        #endregion
    }
}
